home *** CD-ROM | disk | FTP | other *** search
/ Aminet 33 / Aminet 33 - October 1999.iso / Aminet / dev / gui / gtdrag3_5.lha / gtdrag / include / libraries / gtdrag.i < prev   
Encoding:
Text File  |  1999-07-07  |  10.0 KB  |  306 lines

  1.         IFND LIBRARIES_GTDRAG_I
  2. LIBRARIES_GTDRAG_I    SET     1
  3. **
  4. **  $VER: gtdrag.i 3.9 (1.7.99)
  5. **  Includes Release 3.4
  6. **
  7. **  Drag&Drop with GadTools
  8. **
  9. **  Copyright ©1999 pinc Software.
  10. **  All rights Reserved.
  11. **
  12.  
  13. *------------------------------------------------------------------------*
  14.  
  15.         IFND EXEC_LISTS_I
  16.         INCLUDE 'exec/lists.i'
  17.         ENDC
  18.  
  19.         IFND UTILITY_HOOKS_I
  20.         INCLUDE 'utility/hooks.i'
  21.         ENDC
  22.  
  23.         IFND INTUITION_CLASSUSR_I
  24.         INCLUDE 'intuition/classusr.i'
  25.         ENDC
  26.  
  27. *------------------------------------------------------------------------*
  28.  
  29. ********************** ObjectDescription structure **********************
  30.  
  31. * the ObjectDescription structure describes the contents of the object
  32. * being dragged.
  33.  
  34.     STRUCTURE ObjectDescription,0
  35.  
  36.       APTR   od_Object            ; the pointer to the object
  37.       ULONG  od_GroupID           ; DataTypes-GroupID (see datatypes.h)
  38.       ULONG  od_Type              ; rough format of the object
  39.       ULONG  od_InternalType      ; application related type
  40.       APTR   od_Owner             ; owner name or NULL if you are the owner (STRPTR)
  41.       APTR   od_UserData
  42.  
  43.       LABEL  od_SIZE
  44.  
  45.  
  46. * Values for od_Type
  47.  
  48. ODT_UNKNOWN   EQU 0    ; should only be used rarely
  49. ODT_STRING    EQU 1    ; simple c-string (STRPTR)
  50. ODT_NODE      EQU 2    ; (struct Node *)
  51. ODT_IMAGENODE EQU 4    ; (struct ImageNode *)
  52. ODT_TREENODE  EQU 8    ; (struct TreeNode *)
  53. ODT_IMAGE     EQU 16   ; (struct Image *)
  54. ODT_ICON      EQU 32   ; (struct DiskObject *)
  55. ODT_IFF       EQU 64   ; pointer to an IFF-data stream
  56. ODT_LOCK      EQU 128  ; a file lock
  57. ODT_DATATYPE  EQU 256  ; a datatype object
  58. ODT_BITMAP    EQU 512  ; (struct BitMap *)
  59.  
  60.  
  61. ********************** DropMessage structure **********************
  62.  
  63. * You receive the DropMessage structure if someone has dropped an object
  64. * on a gadget or in a window of your application. The IAddress field of
  65. * the IntuiMessage points to this structure.
  66. * Remember: all fields are read-only!
  67.  
  68.     STRUCTURE DropMessage,0
  69.  
  70.       STRUCT dm_Node,MLN_SIZE
  71.       STRUCT dm_Object,od_SIZE   ; dragged object
  72.       APTR   dm_Gadget           ; source gadget
  73.       APTR   dm_Window           ; source gadget's window
  74.       APTR   dm_Target;          ; pointer to the target gadget
  75.       LONG   dm_SourceEntry      ; the list position of the entry
  76.       LONG   dm_TargetEntry      ; dto. - may be higher than the number of entries
  77.       ULONG  dm_Flags
  78.  
  79.       LABEL  dm_SIZE
  80.  
  81. * Values for dm_Flags
  82.  
  83. DMF_DROPOVER  EQU 1              ; for treeviews
  84.  
  85.  
  86. *** The flags for the IDCMP-MsgPort of your Window ***
  87.  
  88. DRAGIDCMP        EQU  LISTVIEWIDCMP!IDCMP_MOUSEBUTTONS
  89. IDCMP_OBJECTDROP EQU  IDCMP_DISKINSERTED!IDCMP_DISKREMOVED
  90.  
  91. * If you get a message of the IDCMP_OBJECTDROP class, someone dropped
  92. * an object on a gadget or in a window that supports it.
  93. * The IAddress-field of the IntuiMessage points to the DragMsg in this
  94. * case.
  95.  
  96. *** a drag key qualifier ***
  97.  
  98. IEQUALIFIER_DRAGKEY  EQU  IEQUALIFIER_LALT!IEQUALIFIER_RALT
  99.  
  100.  
  101. *** Tags to pass to GTD_AddGadget() (a few also for GTD_AddWindow()) ***
  102.  
  103. GTDA_TagBase    EQU  TAG_USER+$90000
  104.  
  105. ** describe the object
  106.  
  107. GTDA_Object            EQU  GTDA_TagBase+1    ; drag node from a non-listview
  108. GTDA_GroupID           EQU  GTDA_TagBase+2    ; Datatypes GroupID (see datatypes/datatypes.h)
  109. GTDA_Type              EQU  GTDA_TagBase+3    ; rough format of object
  110. GTDA_InternalType      EQU  GTDA_TagBase+4    ; internal type flag
  111. GTDA_Mask              EQU  GTDA_InternalType ; for compatibility
  112. GTDA_Image             EQU  GTDA_TagBase+5    ; image for dragging
  113. GTDA_RenderHook        EQU  GTDA_TagBase+6    ; render hook for listview/object
  114. GTDA_ObjectDescription EQU  GTDA_TagBase+7    ; pointer to struct ObjectDescription (contents will be copied)
  115.  
  116. ** general use
  117.  
  118. GTDA_Width         EQU  GTDA_TagBase+8     ; width of icon (only for GTDA_RenderHook & GTDA_Images)
  119. GTDA_Height        EQU  GTDA_TagBase+9     ; height of a icon ("")
  120. GTDA_NoDrag        EQU  GTDA_TagBase+10    ; do not drag from this gadget
  121. GTDA_AcceptTypes   EQU  GTDA_TagBase+11    ; accept mask value for internal drag&drop
  122. GTDA_AcceptMask    EQU  GTDA_AcceptTypes   ; for compatibility
  123. GTDA_AcceptFunc    EQU  GTDA_TagBase+12    ; function which checks for acceptance of the drag
  124. GTDA_ObjectFunc    EQU  GTDA_TagBase+13    ; callback function before a drag starts
  125. GTDA_SourceEntry   EQU  GTDA_TagBase+21    ; specifies the dm_SourceEntry field
  126.  
  127. ** listview specials
  128.  
  129. GTDA_ItemHeight    EQU  GTDA_TagBase+14    ; height of a listview entry
  130. GTDA_NoPosition    EQU  GTDA_TagBase+15    ; no position highlighting and scrolling
  131. GTDA_Same          EQU  GTDA_TagBase+16    ; can move items inside its own list
  132. GTDA_Images        EQU  GTDA_TagBase+17    ; drags only images (listview MUST contain ImageNodes/TreeNodes)
  133. GTDA_NoScrolling   EQU  GTDA_TagBase+18    ; disables scrolling
  134. GTDA_DropOverItems EQU  GTDA_TagBase+19    ; objects are dropped over other items
  135. GTDA_TreeView      EQU  GTDA_TagBase+20    ; activate treeview specials
  136. GTDA_DropBetweenItems EQU GTDA_TagBase+22  ; works only in conjungtion with GTDA_DropOverItems
  137.  
  138.  
  139. *** Tags to pass to GTD_AddApp() ***
  140.  
  141. GTDA_InternalOnly  EQU  GTDA_TagBase+42    ; only internal drag&drop
  142. GTDA_NewStyle      EQU  GTDA_TagBase+43    ; v3 is supported
  143.  
  144.  
  145. *** Constants for passing to GTD_GetHook() ***
  146.  
  147. GTDH_IMAGE      EQU  1
  148. GTDH_TREE       EQU  2
  149. GTDH_IFFSTREAM  EQU  3
  150.  
  151. *** data for GTDH_IFFSTREAM, set Hook's h_data to this structure ***
  152.  
  153.     STRUCTURE IFFStreamHookData,0
  154.  
  155.       APTR   is_Pool           ; a memory pool, buffer will be AllocMem()ed if NULL
  156.       APTR   is_Buffer         ; pointer to the buffer
  157.       ULONG  is_Size;          ; size of the buffer
  158.       ULONG  is_Position;      ; current stream position
  159.  
  160.       LABEL  ifshd_SIZE
  161.  
  162.  
  163. ********************** BOOPSI gadgets **********************
  164.  
  165. BOOPSI_KIND    EQU  1000                   ; GTD_AddGadget() - Type
  166.  
  167. GM_OBJECTDRAG  EQU  GTDA_TagBase+1000      ; see structures below
  168. GM_OBJECTDROP  EQU  GTDA_TagBase+1001
  169. GM_RENDERDRAG  EQU  GTDA_TagBase+1002
  170.  
  171.  
  172.     STRUCTURE gpObjectDrag,4
  173.  
  174.       ; ULONG  MethodID
  175.       APTR   gpod_Object       ; pointer to an ObjectDescription
  176.       APTR   gpod_Source       ; pointer to the source gadget
  177.       WORD   gpod_X
  178.       WORD   gpod_Y            ; mouse coordinates
  179.  
  180.       LABEL  gpodrag_SIZE
  181.  
  182. * if GM_OBJECTDRAG is invoked you should return one of these values
  183. * to report gtdrag that you could make use of it (to speed up things)
  184.  
  185. GMR_REJECTOBJECT  EQU  1
  186. GMR_ACCEPTOBJECT  EQU  2
  187. GMR_UPDATE        EQU  4       ; please update me (GM_RENDERDRAG will be invoked)
  188. GMR_FINAL         EQU  8       ; store the result and do not ask again
  189.  
  190.  
  191.     STRUCTURE gpObjectDrop,4
  192.  
  193.       ; ULONG  MethodID
  194.       APTR   gpod_Message      ; pointer to a DropMessage
  195.       ULONG  gpod_Qualifier
  196.  
  197.       LABEL  gpodrop_SIZE
  198.  
  199.  
  200.     STRUCTURE gpRenderDrag,4
  201.  
  202.       ; ULONG  MethodID
  203.       APTR   gprd_GInfo        ; gadget context
  204.       APTR   gprd_RPort        ; already for use
  205.       ULONG  gprd_Mode         ; one of the GRENDER_xxx
  206.       WORD   gprd_MouseX
  207.       WORD   gprd_MouseY       ; mouse coordinates
  208.  
  209.       LABEL  gprd_SIZE
  210.  
  211. GRENDER_HIGHLIGHT    EQU 0     ; highlight yourself
  212. GRENDER_DELETE       EQU 1     ; delete all highlights
  213. GRENDER_INTERIM      EQU 2     ; refreshing between two GRENDER_HIGHLIGHT
  214.  
  215. * You have to return TRUE if you processed the rendering yourself,
  216. * otherwise gtdrag renders the standard highlighting.
  217. * Returning FALSE will also let gtdrag stop sending you GM_OBJECTDRAG
  218. * messages for the current drag.
  219.  
  220.  
  221.  
  222.                      ***************************
  223. ********************** additional structures ***********************
  224. **                  **************************                    **
  225. **                                                                **
  226. ** The additional structures provide special rendering options in **
  227. ** listviews which are supported by gtdrag. The CallBack-Hooks    **
  228. ** necessary to display these are reachable via the API.          **
  229. ** See GTD_GetHook().                                             **
  230. **                                                                **
  231. ********************************************************************
  232.  
  233.  
  234. ********************** ImageNode **********************
  235.  
  236. * The ImageNode structure is used to have both text and images in a listview.
  237. * A render hook for this type is provided. It is not a must!
  238.  
  239.  
  240.     STRUCTURE ImageNode,0
  241.  
  242.       APTR  in_Succ        ; same as ListNode
  243.       APTR  in_Pred
  244.       UBYTE in_Type
  245.       BYTE  in_Pri
  246.       APTR  in_Name
  247.       APTR  in_Image       ; plus pointer to an Image
  248.  
  249.       LABEL in_SIZE
  250.  
  251.  
  252. ********************** Tree Structures **********************
  253.  
  254. * The TreeNode structure provides the possibility of displaying trees
  255. * and images within a listview. A special tree hook is included.
  256.  
  257.  
  258.     STRUCTURE TreeList,0
  259.  
  260.       STRUCT tl_View,MLH_SIZE
  261.       STRUCT tl_Tree,MLH_SIZE
  262.  
  263.       LABEL tl_SIZE
  264.  
  265.  
  266.     STRUCTURE gTreeNode,0
  267.  
  268.       STRUCT gtn_Node,in_SIZE       ; avoid complications with datatypes/datatypes.i
  269.       STRUCT gtn_ViewNode,MLN_SIZE
  270.       STRUCT gtn_Nodes,MLH_SIZE
  271.       ULONG  gtn_DepthLines
  272.       UBYTE  gtn_Depth
  273.       UWORD  gtn_Flags              ; ""
  274.       WORD   gtn_X
  275.       WORD   gtn_Y
  276.       APTR   gtn_Special
  277.  
  278.       LABEL  gtn_SIZE
  279.  
  280.  
  281. TNF_NONE        EQU 0
  282. TNF_CONTAINER   EQU 1
  283. TNF_OPEN        EQU 2
  284. TNF_ADD         EQU 4
  285. TNF_REPLACE     EQU 8
  286. TNF_LAST        EQU 16     ; last node in group
  287. TNF_STATIC      EQU 32     ; can't move node
  288. TNF_NOSUBDIRS   EQU 64     ; can't create sub-directory (this flag is for you only)
  289. TNF_SORT        EQU 256    ; sort by name
  290. TNF_HIGHLIGHTED EQU 512    ; highlight name
  291.  
  292.  
  293. ****** the following macros are C macros ******
  294.  
  295. ** from the ViewNode to the TreeNode **
  296. * #define TREENODE(ln) ((struct TreeNode *)((UBYTE *)ln - sizeof(struct ImageNode)))
  297.  
  298. ** size of the knobs **
  299. TREEKNOBSIZE  EQU  6
  300.  
  301. ** is the mouse pointer over the tree-knob? **
  302. * #define MouseOverTreeKnob(tn,h,msg) ((tn)->tn_X != -1 && (msg)->MouseX >= (tn)->tn_X && (msg)->MouseY >= (tn)->tn_Y+h && (msg)->MouseX <= (tn)->tn_X+TREEKNOBSIZE && (msg)->MouseY <= (tn)->tn_Y+TREEKNOBSIZE+h)
  303.  
  304.  
  305. ENDC  ; LIBRARIES_GTDRAG_I
  306.